package beans;


import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.InitializingBean;

import java.util.HashMap;
import java.util.Map;

/**
 * @author Wen
 * @date 2023/4/23 16:29
 */
public class UserDao implements InitializingBean, DisposableBean {
    private static Map<String, String> map = new HashMap<>();

    public void initDataMethod(){
        System.out.println("执行：init-method");
        map.put("001", "zzw");
        map.put("002", "sxy");
    }
    public String queryUserName(String uId) {
        return map.get(uId);
    }

    @Override
    public void afterPropertiesSet() {
        System.out.println("执行: InitializingBean");
    }

    public void destroyMethod() {
        System.out.println("执行: destroy-method");
    }

    @Override
    public void destroy() throws Exception {
        System.out.println("执行: DisposableBean");
    }
}
